package org.jivesoftware.smackx.workgroup.ext.forms;

import org.jivesoftware.smack.packet.IQ;
import org.jivesoftware.smack.provider.IQProvider;
import org.jivesoftware.smack.util.PacketParserUtils;
import org.xmlpull.v1.XmlPullParser;

public class WorkgroupForm extends IQ
{
  public static final String ELEMENT_NAME = "workgroup-form";
  public static final String NAMESPACE = "http://jivesoftware.com/protocol/workgroup";

  public String getChildElementXML()
  {
    StringBuilder localStringBuilder = new StringBuilder();
    localStringBuilder.append("<").append("workgroup-form").append(" xmlns=\"").append("http://jivesoftware.com/protocol/workgroup").append("\">");
    localStringBuilder.append(getExtensionsXML());
    localStringBuilder.append("</").append("workgroup-form").append("> ");
    return localStringBuilder.toString();
  }

  public static class InternalProvider
  implements IQProvider
  {
    public IQ parseIQ(XmlPullParser paramXmlPullParser)
      throws Exception
    {
      WorkgroupForm localWorkgroupForm = new WorkgroupForm();
      int i = 0;
      while (true)
      {
        int j;
        do
          while (true)
          {
            if (i != 0)
              return localWorkgroupForm;
            j = paramXmlPullParser.next();
            if (j != 2)
              break;
            localWorkgroupForm.addExtension(PacketParserUtils.parsePacketExtension(paramXmlPullParser.getName(), paramXmlPullParser.getNamespace(), paramXmlPullParser));
          }
        while ((j != 3) || (!(paramXmlPullParser.getName().equals("workgroup-form"))));
        i = 1;
      }
    }
  }
}